Public Class CustomArrayConverter
    Inherits System.ComponentModel.ArrayConverter

    Public Class CustomPropertyDescriptor
        Inherits System.ComponentModel.PropertyDescriptor

        Private m_objPropertyDescriptor As System.ComponentModel.PropertyDescriptor

        Public Sub New(ByVal name As String, ByVal p As System.ComponentModel.PropertyDescriptor)
            MyBase.New(name, Nothing)
            m_objPropertyDescriptor = p
        End Sub

        Public Overrides ReadOnly Property Attributes() As System.ComponentModel.AttributeCollection
            Get
                Return m_objPropertyDescriptor.Attributes
            End Get
        End Property

        Public Overrides Function CanResetValue(ByVal component As Object) As Boolean
            m_objPropertyDescriptor.CanResetValue(component)
        End Function

        Public Overrides ReadOnly Property ComponentType() As System.Type
            Get
                Return m_objPropertyDescriptor.ComponentType
            End Get
        End Property

        Public Overrides Function GetValue(ByVal component As Object) As Object
            Return m_objPropertyDescriptor.GetValue(component)
        End Function

        Public Overrides ReadOnly Property IsReadOnly() As Boolean
            Get
                Return m_objPropertyDescriptor.IsReadOnly
            End Get
        End Property

        Public Overrides ReadOnly Property PropertyType() As System.Type
            Get
                Return m_objPropertyDescriptor.PropertyType
            End Get
        End Property

        Public Overrides Sub ResetValue(ByVal component As Object)
            m_objPropertyDescriptor.ResetValue(component)
        End Sub

        Public Overrides Sub SetValue(ByVal component As Object, ByVal value As Object)
            m_objPropertyDescriptor.SetValue(component, value)
        End Sub

        Public Overrides Function ShouldSerializeValue(ByVal component As Object) As Boolean
            m_objPropertyDescriptor.ShouldSerializeValue(component)
        End Function
    End Class


    Public Overrides Function ConvertTo(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal culture As System.Globalization.CultureInfo, ByVal value As Object, ByVal destinationType As System.Type) As Object
        Return Nothing
    End Function

    Public Overrides Function GetProperties(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal value As Object, ByVal attributes() As System.Attribute) As System.ComponentModel.PropertyDescriptorCollection
        Dim intIndex As Integer = 1
        Dim PropertyList As New List(Of CustomPropertyDescriptor)

        For Each objPropertyDescriptor As System.ComponentModel.PropertyDescriptor In MyBase.GetProperties(context, value, attributes)
            PropertyList.Add(New CustomPropertyDescriptor("[" + intIndex.ToString + "]", objPropertyDescriptor))
            intIndex += 1
        Next

        Return New System.ComponentModel.PropertyDescriptorCollection(PropertyList.ToArray)
    End Function

End Class

Public Class CustomDoubleConverter
    Inherits System.ComponentModel.DoubleConverter

    Public Overrides Function CanConvertFrom(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal sourceType As System.Type) As Boolean
        If sourceType Is GetType(String) Then
            Return True
        End If

        Return MyBase.CanConvertTo(context, sourceType)
    End Function

    Public Overrides Function ConvertFrom(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal culture As System.Globalization.CultureInfo, ByVal value As Object) As Object
        If TypeOf value Is String Then
            Dim strValue As String = value.ToString.Replace("D", "E")

            Return Double.Parse(strValue, Globalization.NumberStyles.Any)
        ElseIf TypeOf value Is Double Then
            Return value
        End If

        Return MyBase.ConvertFrom(context, culture, value)
    End Function

    Public Overrides Function ConvertTo(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal culture As System.Globalization.CultureInfo, ByVal value As Object, ByVal destinationType As System.Type) As Object
        If destinationType Is GetType(String) Then
            Dim dblValue As Double = CType(value, Double)
            Dim strValue As String = dblValue.ToString

            If strValue.EndsWith("0000") Then
                Return dblValue.ToString("0.##########E+00")
            Else
                Return strValue
            End If
        End If

        Return MyBase.ConvertTo(context, culture, value, destinationType)
    End Function

End Class

Public Class CustomEditorConverter
    Inherits System.ComponentModel.TypeConverter

    Public Overrides Function ConvertTo(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal culture As System.Globalization.CultureInfo, ByVal value As Object, ByVal destinationType As System.Type) As Object
        Return Nothing
    End Function

End Class

Public Class CustomExpandableObjectConverter
    Inherits System.ComponentModel.ExpandableObjectConverter

    Public Overrides Function ConvertTo(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal culture As System.Globalization.CultureInfo, ByVal value As Object, ByVal destinationType As System.Type) As Object
        Return Nothing
    End Function

End Class

Public Class CustomInt32Converter
    Inherits System.ComponentModel.Int32Converter

    Private m_intBase As Integer
    Private m_ValueList As New List(Of String)

    Public Sub New(ByVal count As Integer, Optional ByVal base As Integer = 0)
        If count > base Then
            For intIndex As Integer = base To base + count - 1
                m_ValueList.Add("(" + intIndex.ToString + ")")
            Next
            m_intBase = base
        Else
            Throw New ArgumentException
        End If
    End Sub

    Public Sub New(ByVal propertyName As String, ByVal count As Integer, Optional ByVal base As Integer = 0)
        If count > base Then
            For intIndex As Integer = base To base + count - 1
                m_ValueList.Add(Language.ReadMessages("msg" + propertyName + "_" + intIndex.ToString))
            Next
            m_intBase = base
        Else
            Throw New ArgumentException
        End If
    End Sub

    Public Sub New(ByVal values() As String, ByVal isKeyList As Boolean, Optional ByVal base As Integer = 0)
        If values Is Nothing Then
            Throw New ArgumentException
        Else
            If isKeyList Then
                For Each value As String In values
                    m_ValueList.Add(Language.ReadMessages(value))
                Next
            Else
                For Each value As String In values
                    m_ValueList.Add(value)
                Next
            End If
            m_intBase = base
        End If
    End Sub

    Public Overrides Function CanConvertFrom(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal sourceType As System.Type) As Boolean
        If sourceType Is GetType(String) Then
            Return True
        End If

        Return MyBase.CanConvertFrom(context, sourceType)
    End Function

    Public Overrides Function ConvertFrom(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal culture As System.Globalization.CultureInfo, ByVal value As Object) As Object
        Dim intIndex As Integer

        If TypeOf value Is String Then
            intIndex = m_ValueList.IndexOf(value.ToString)
            If intIndex = -1 Then
                Throw New Exception
            Else
                Return intIndex + m_intBase
            End If
        ElseIf TypeOf value Is Integer Then
            intIndex = CInt(value)
            If intIndex < m_intBase OrElse intIndex >= (m_ValueList.Count + m_intBase) Then
                Throw New Exception
            Else
                Return intIndex
            End If
        End If

        Return MyBase.ConvertFrom(context, culture, value)
    End Function

    Public Overrides Function ConvertTo(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal culture As System.Globalization.CultureInfo, ByVal value As Object, ByVal destinationType As System.Type) As Object
        If TypeOf value Is Integer Then
            Return m_ValueList.Item(CInt(value) - m_intBase)
        ElseIf m_ValueList.Contains(value.ToString) Then
            Return value.ToString
        End If

        Return MyBase.ConvertTo(context, culture, value, destinationType)
    End Function

    Public Overrides Function GetStandardValues(ByVal context As System.ComponentModel.ITypeDescriptorContext) As System.ComponentModel.TypeConverter.StandardValuesCollection
        Return New StandardValuesCollection(m_ValueList)
    End Function

    Public Overrides Function GetStandardValuesExclusive(ByVal context As System.ComponentModel.ITypeDescriptorContext) As Boolean
        Return True
    End Function

    Public Overrides Function GetStandardValuesSupported(ByVal context As System.ComponentModel.ITypeDescriptorContext) As Boolean
        Return True
    End Function

End Class

Public Class CustomInt32ConverterDPEXT
    Inherits CustomInt32Converter

    Public Sub New()
        MyBase.New("DPEXT", 3, 1)
    End Sub

End Class

Public Class CustomInt32ConverterGAUSSIANS
    Inherits CustomInt32Converter

    Public Sub New()
        MyBase.New(5)
    End Sub

End Class

Public Class CustomInt32ConverterIAMP
    Inherits CustomInt32Converter

    Public Sub New()
        MyBase.New("IAMP", 2)
    End Sub

End Class

Public Class CustomInt32ConverterIDEP
    Inherits CustomInt32Converter

    Public Sub New()
        MyBase.New("IDEP", 8)
    End Sub

End Class

Public Class CustomInt32ConverterIDREC
    Inherits CustomInt32Converter

    Public Sub New()
        MyBase.New("IDREC", 3)
    End Sub

End Class

Public Class CustomInt32ConverterIEFMA
    Inherits CustomInt32Converter

    Public Sub New()
        MyBase.New("IEFMA", 2, 1)
    End Sub

End Class

Public Class CustomInt32ConverterIFEPO
    Inherits CustomInt32Converter

    Public Sub New()
        MyBase.New("IFEPO", 4)
    End Sub

End Class

Public Class CustomInt32ConverterIFIEMOB
    Inherits CustomInt32Converter

    Public Sub New()
        MyBase.New(2)
    End Sub

End Class

Public Class CustomInt32ConverterIFLUX
    Inherits CustomInt32Converter

    Public Sub New()
        MyBase.New("FLUX", 2, 1)
    End Sub

End Class

Public Class CustomInt32ConverterIHDIP
    Inherits CustomInt32Converter

    Public Sub New()
        MyBase.New(3)
    End Sub

End Class

Public Class CustomInt32ConverterILBACK
    Inherits CustomInt32Converter

    Public Sub New()
        MyBase.New("ILBACK", 2)
    End Sub

End Class

Public Class CustomInt32ConverterINTER
    Inherits CustomInt32Converter

    Public Sub New()
        MyBase.New("INTER", 3)
    End Sub

End Class

Public Class CustomInt32ConverterIOLAY
    Inherits CustomInt32Converter

    Public Sub New()
        MyBase.New(2, 1)
    End Sub

End Class

Public Class CustomInt32ConverterIOPTOP
    Inherits CustomInt32Converter

    Public Sub New()
        MyBase.New(9, 1)
    End Sub

End Class

Public Class CustomInt32ConverterIS
    Inherits CustomInt32Converter

    Public Sub New()
        MyBase.New("IS", 6, 1)
    End Sub

End Class

Public Class CustomInt32ConverterISRSPE
    Inherits CustomInt32Converter

    Public Sub New()
        MyBase.New("ISRSPE", 2)
    End Sub

End Class

Public Class CustomInt32ConverterISRBOTH
    Inherits CustomInt32Converter

    Public Sub New()
        MyBase.New("ISRBOTH", 2, 1)
    End Sub

End Class

Public Class CustomInt32ConverterITUBA
    Inherits CustomInt32Converter

    Public Sub New()
        MyBase.New("ITUBA", 4)
    End Sub

End Class

Public Class CustomInt32ConverterITUNN
    Inherits CustomInt32Converter

    Public Sub New()
        MyBase.New("ITUNN", 4)
    End Sub

End Class

Public Class CustomInt32ConverterITURE
    Inherits CustomInt32Converter

    Public Sub New()
        MyBase.New(3)
    End Sub

End Class

Public Class CustomInt32ConverterLEVELS
    Inherits CustomInt32Converter

    Public Sub New()
        MyBase.New(3)
    End Sub

End Class

Public Class CustomInt32ConverterLICOH
    Inherits CustomInt32Converter

    Public Sub New()
        MyBase.New("LICOH", 2)
    End Sub

End Class

Public Class CustomInt32ConverterNIP
    Inherits CustomInt32Converter

    Public Sub New()
        '0.9.4
        'MyBase.New(New String() {"NIP", "PIN"}, False)
        MyBase.New(New String() {"PIN", "NIP"}, False)
    End Sub

End Class

Public Class CustomInt32ConverterNOUTFILE
    Inherits CustomInt32Converter

    Public Sub New()
        MyBase.New("NOUTFILE", 3)
    End Sub

End Class

Public Class CustomInt32ConverterNTRAP
    Inherits CustomInt32Converter

    Public Sub New()
        MyBase.New(New String() {"U", "V"}, False, 1)
    End Sub

End Class

Public Class CustomInt32ConverterONOFF
    Inherits CustomInt32Converter

    Public Sub New()
        MyBase.New(New String() {"msgOFF", "msgON"}, True)
    End Sub

End Class

Public Class CustomInt32ConverterYESNO
    Inherits CustomInt32Converter

    Public Sub New()
        MyBase.New(New String() {"msgNO", "msgYES"}, True)
    End Sub

End Class
